package com;

import com.dao.OrderDAO;
import com.model.Order;
import com.model.OrderDetail;
import com.model.User;
import com.service.OrderService;
import com.service.UserService;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

import java.util.List;

@SpringBootApplication
@MapperScan("com.dao")
public class SpringbootDemo {
    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(SpringbootDemo.class, args);
        OrderService orderService = context.getBean(OrderService.class);
        Order order = orderService.getSingle(1);

       // System.out.println("userId in order: "+order.getUserId());

        List<OrderDetail> details=  order.getInfoes();
         System.out.println(order.getInfoes().size());
         for (OrderDetail detail: details){
             System.out.println("OrderinfoId:"+detail.getOrderinfoId());
             System.out.println("productId:"+detail.getProductId());
             System.out.println("orderId:"+detail.getOrderId());

         }



    /*    List<OrderDetail> orderDetailList = orderService.getListByOrderId(1);
        System.out.println(orderDetailList.size());*/
    }
}
